#include "DualClientSendHandler.h"
#include "DualServerRecvHandler.h"

using namespace log4cplus;

Logger DualClientSendHandler::log=GetLogger(LOG4CPLUS_TEXT("DualClientSendHandler"));

void DualClientSendHandler::GetSendRecvInfo(ClientContext &client,SOCKET *sendSock,SOCKET *recvSock,WSABUF **buf,WSABUF **weakRefBuf,OVERLAPPED **ovl)
{
	unsigned int clienSequenceNo=client.SequenceNo();
	LOG4CPLUS_DEBUG_FMT(log,LOG4CPLUS_TEXT("[Client%d]Dual client send handler set sendrecv info."),clienSequenceNo);
	ClientContextExt &extObj=client.ExtContext();
	*sendSock=client.SrcSock();
	*recvSock=client.DestSock();
	*buf=extObj.Buffer2();
	*weakRefBuf=extObj.WeakRefBuffer2();
	*ovl=extObj.OVL2();
}

void DualClientSendHandler::SetNextHandler(ClientContext &client)
{
	delete client.ExtContext().SetDestHandler(new DualServerRecvHandler());
}